package nullInvader.Engine;

import java.util.LinkedList;
import java.util.List;

/**
 * Applikationsutveckling i Java, 5DV135 HT12 Project
 * 
 * File: TowerManager.java Description: Handles the towers of the current map
 * 
 * Date: 17 december 2012
 * 
 * cs-user: dv11flh
 * 
 * @author Fredrik Loch
 */
public class TowerManager {

    //
    // Fields
    //

    protected List<Tower> towerList;
    protected Player player;

    //
    // Constructors
    //

    public TowerManager(Player p) {
	player = p;
	towerList = new LinkedList<Tower>();
    }

    public TowerManager(Player p, List<Tower> t) {
	player = p;
	towerList = t;
    }

    //
    // Methods
    //

    /**
     * Adds a tower to the list of towers
     * 
     * @param t
     */
    public void addTower(Tower t) {
	towerList.add(t);
    }

    /**
     * Method loops through all towers and runs the takeShot methods
     */
    public void tick() {
	for (Tower t : towerList) {
	    t.takeShot();
	}
    }
}
